package com.atguigu.dga.governance.scheduler;


import com.atguigu.dga.governance.service.GovernanceAssessDetailService;
import com.atguigu.dga.governance.service.GovernanceAssessGlobalService;
import com.atguigu.dga.governance.service.GovernanceAssessTableService;
import com.atguigu.dga.governance.service.GovernanceAssessTecOwnerService;
import com.atguigu.dga.meta.service.TableMetaInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class GovernanceScheduler {

    @Autowired
    private GovernanceAssessTableService assessTableService;

    @Autowired
    private GovernanceAssessGlobalService assessGlobalService;

    @Autowired
    private GovernanceAssessTecOwnerService assessTecOwnerService;

    @Autowired
    private TableMetaInfoService tableMetaInfoService;

    @Autowired
    private GovernanceAssessDetailService assessDetailService;

    @Scheduled(cron = "30 58 14 * * ? ")
    public void assess() throws Exception {
        Date date = new Date();
        //用当前日期减一天

        //1 采集
        tableMetaInfoService.extractMetaData("gmall", "2023-05-01");
        //2 考评
        assessDetailService.assessMetrics("2023-05-01");
        //3 打分
        assessTableService.genAssessTable("2023-05-01");
        assessTecOwnerService.genAssessTecOwner("2023-05-01");
        assessGlobalService.genAssessGlobal("2023-05-01");

    }
}
